<!--  -->
<template>
  <div class='' style="padding:20px">
    <div style="margin-bottom:10px">
      教师名称
      <el-input v-model="realName" placeholder="请输入教师名称" style="width:300px" clearable></el-input>
      <el-button type="primary" @click="getPage">查询</el-button>
      <el-button type="" @click="clearContent">重置</el-button>
    </div>
    <!-- <div style="display:flex;flex-wrap:wrap; margin: 10px auto">
      <div style="margin-bottom:10px;border:1px solid gray;padding:4px;margin-right:1%;width:19%;" v-for='i in dataList' :key='i.id'>
        <div style="text-align:center">
          <el-image :src="host + i.headPath" style='width:320px;height:230px;margin-right:10px'></el-image>
        </div>
        <div style="display:flex;justify-content:space-between;cursor:pointer">
          <div style="flex:5; text-align:center">
            <div>{{i.realName}}</div>
            <div>{{i.ratingTitle}}</div>
            <div>{{i.school}}</div>
          </div>
          <div style="flex:1">
            <i class="el-icon-arrow-right" style="margin-top: 12px;font-size: 45px;color: #aaa;font-weight: 900;cursor:pointer" @click="getDetail(i)"></i>
          </div>
        </div>
      </div>
    </div> -->
    <CommonPic :list='dataList' @clickDetail='getDetail' isDetail='teacher'></CommonPic>

    <el-empty v-if='!dataList.length' description='暂无数据'></el-empty>
    <el-pagination class="pageBar"  background @size-change="sizeChange" @current-change="currentChange" :current-page="pageInfo.currentPage" :page-sizes="[2, 5,10, 20, 30]" :page-size="pageInfo.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalRecordCount">
    </el-pagination>
  </div>
</template>

<script>
// import teacherApi from "../api/teacher.service.js";
import operateApi from "../api/operate.service.js";
import { log } from "util";
export default {
  components: {},
  data() {
    return {
      realName: "",
      pageInfo: {
        currentPage: 1,
        pageSize: 10,
      },
      totalRecordCount: "",
      dataList: [],
      host: window.location.href.split("/#/")[0] + "/api",
      isDetail:'isDetail'
    };
  },
  mounted() {
    this.getPage();
  },
  computed: {},
  watch: {},
  methods: {
    async getPage() {
      let { data } = await operateApi.getPage({
        realName: this.realName,
        ...this.pageInfo,
      });
      this.dataList = data.records;
      this.totalRecordCount = data.total;
    },
    // 重置
    clearContent() {
      this.realName = "";
      this.getPage()
    },
    // 获取详情
    async getDetail(data) {
      this.$router.push({
        path: "/teacherDetail",
        query: {
          data: data.userId,
          originPath: "/exper/views/operation/teacherManger",
        },
      });
    },
    sizeChange(val) {
      this.pageInfo.pageSize = val;
      this.getPage();
    },
    currentChange(val) {
      this.pageInfo.currentPage = val;
      this.getPage();
    },
  },
  created() {},
};
</script>
<style >
</style>